package behavior.command;

/**
 * @author lzp
 * @Date:2023/2/27
 * @description:
 */
public class TextEditor {

	private StringBuilder buffer = new StringBuilder();

	public void copy() {
		System.out.println("已复制内容");
	}

	public void paste() {
		System.out.println("获取粘贴板上的内容");
		String text = "粘贴板上的内容";
		add(text);
	}

	public void add(String s) {
		buffer.append(s);
	}

	public void delete() {
		if (buffer.length() > 0) {
			buffer.deleteCharAt(buffer.length() - 1);
		}
	}

	public String getState() {
		return buffer.toString();
	}

}
